package jee.boot.module.act.rest;

import jee.boot.common.basic.CrudController;
import jee.boot.common.basic.result.ResponseMessage;
import jee.boot.common.basic.result.Result;
import jee.boot.entity.activiti.ActModel;
import jee.boot.module.act.service.ActModelService;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;

/**
 * 模型服务接口
 * 
 * @author
 * @version 2019-01-30
 */
@RestController
@RequestMapping(value = "/model")
public class ActModelRestController extends CrudController<ActModelService, ActModel> {
    /**
     * 从模型中部署
     *
     * @param entity
     * @return
     */
    @PostMapping("/deploy")
    public ResponseMessage<ActModel> deploy(@RequestBody ActModel entity) {
        service.deploy(entity);
        return Result.success();
    }
    /**
     * 导出xml
     *
     * @param entity
     * @return
     */
    @GetMapping (value="/exportXml")
    public void exportXml(ActModel entity, HttpServletResponse response) {
        service.exportXml(entity,response);
    }
    /**
     * 导出png
     *
     * @param entity
     * @return
     */
    @GetMapping (value="/exportPng")
    public void exportPng(ActModel entity, HttpServletResponse response) {
        service.exportPng(entity,response);
    }
}
